<style scoped>
  .content .w980{
    padding-top: 0;
  }
  .fr div.list-tips.breadcrumb{
    margin-bottom: 0;
  }
  .nav-path{
    position: relative;
  }
  .nav-path ol{
    width: 100%;
    height: 36px;
  }
  .nav-path button.add-hsp-btn{
    position: absolute;
    top: 0;
    right: 0;
  }
  .nav-path ol li a{
    color: #444;
  }
  .nav-path ol li:last-child{
    color: #00CB8F;
  }
  .nav-path ol li.li-last{
    color: #00CB8F;
  }

  /*返回上一级*/
  .return-prev{
    color: #0DC78A;
    text-decoration: none;
    float: right;
  }
  /*机构列表*/
  .list-tips{
    padding: 0;
    height: 36px;
    line-height: 36px;
    background: #F5F5F4  url(../../assets/img/list_tips.png) no-repeat 20px center;
    background-size: 4px 20px;
  }
  .list-tips span{
    float: left;
    font-size: 16px;
    height: 36px;
    line-height: 36px;
    margin-left: 36px;
    text-align: left;
  }
  .list-tips span.default-span{
    color: #6C6C6C;
    font-size: 14px;
    padding: 0 15px;
    cursor: pointer;
  }
  .list-tips span.active-span{
    color: #fff;
    background-color: #00C484;
  }
  .list-tips button.close span{
    font-size: 18px;
    margin: 2px 10px 0 0;
    text-align: left;
  }
  .org-list .list-tips button{
    float: right;
    width: 118px;
    height: 36px;
    text-align: center;
    color: #fff;
    border-radius: 10px;
    background-color: #00A9FD;
    font-size: 16px;
    line-height: 36px;
    margin-right: 20px;
    /*margin-top: calc(50%-0.18rem);*/
    margin-top: 6px;
    outline: none;
  }
  .org-list .list-opera .form-inline label{
    margin: 0 10px 0 23px;
    font-size: 12px;
    color: #666460;
    font-weight: 400;
  }
  .org-list .list-opera .form-inline button{
    width: 98px;
    height: 32px;
    display: inline-block;
    border-radius: 16px;
  }
  .list-opera{
    margin: 10px 0 20px 0;
  }
  .list-opera .form-inline .clear-research{
    margin-left: 15px;
    height: 32px;
  }
  .list-content table th {
      text-align: center;
      line-height: 36px;
      height: 36px;
      font-weight: normal;
      background-color: #F8F8F7;
  }
  .list-content table tr:nth-child(odd){
    background-color: #fff;
  }
  .list-content table tr:nth-child(even){
    background-color: #F6FBF8;
  }
  .list-content table td {
      line-height: 40px;
      text-align: center;
  }
  .list-content table tr td:nth-child(1) {
      color: #333
  }
  .list-content table tr td:nth-child(2),.list-content table tr td:nth-child(3) {
      color: #333
  }
  .list-content table tr td a.glyphicon{
    display: inline-block;
    padding: 0 0 0 20px;
    height: 16px;
    font-size: 12px;
    text-align: right;
    margin-right: 5px;
    text-decoration: none;
    color: #444;
    background-repeat: no-repeat!important;
    background-position: left center!important;
  }
  .list-content table tr td a:first-child{
    background: url(../../assets/img/edit.png);
    background-size: 14px;
  }
  .list-content table tr td .glyphicon:hover {
      color: #1dc499;
      cursor: pointer;
  }
  .list-content table tr td a:nth-child(1){
    background: url(../../assets/img/watch.png);
    background-size: 17px 12px;
  }
  .list-content table tr td a:nth-child(2){
    background: url(../../assets/img/nav.png);
    background-size: 16px;
  }
  .list-content table tr td a:nth-child(3){
    background: url(../../assets/img/account.png);
    background-size: 16px;
  }
  .list-content table tr td a:nth-child(4){
    background: url(../../assets/img/report-exp.png);
    background-size: 13px 16px;
  }
  .list-content table tr td a:nth-child(5){
    background: url(../../assets/img/dele4.png);
    background-size: 14px;
  }

  /*模态框基本设置*/
  .modal-dialog .breadcrumb{
    margin-bottom: 0;
  }
  #add-org-cover .modal-body{
    height: 500px;
    overflow: auto;
    padding: 0 15px;
  }
  /*模态框*/
  .modal-dialog{
    width: 70%;
    height: 600px;
    border-top: 0;
  }
  .modal-body .form-group{
    display: block;
    margin-bottom: 18px;
    margin-top: 18px;
  }
  .modal-body .increase-team-per select,.modal-body .increase-team-per input{
    width: 60%;
    display: inline-block;
  }
  .modal-body .form-group-foot{
    text-align: center;
  }
  .modal-body .form-group label{
    width: 27%;
    text-align: right;
  }
  .modal-body .form-inline .form-control{
    width: 48%;
    text-align: left;
    text-indent: 10px;
    margin-left: 30px;
  }
    /*hospital Map*/
  .modal-body .form-inline .list-top-title{
    vertical-align: top;
  }
  .modal-body .form-inline #map-container1{
    position: relative;
  }
  .modal-body .form-inline .hospital-map{
    width: 90%;
    height: 400px;
    overflow: hidden;
    border: 1px solid #ccc;
    border-radius: 4px;
    display: inline-block;
    text-align: center;
    text-indent: 10px;
    margin-left: 6%;
  }
  .modal-body .form-inline img{
    width: 80px;
    height: 80px;
    float: left;
    border: 0;
    text-indent: 0;
    border-radius: 10% 5%;
  }
  .modal-body .form-group .sim-explain-textarea{
    width: 48%;
    min-height: 122px;
    margin-left: 30px;
    overflow: auto;
    overflow-x: hidden;
    resize: none;
  }
  

  .modal-body .list-tips .team-label{
    float: left;
    height: 36px;
    line-height: 36px;
  }
  .modal-body .list-tips .new-per{
    float: right;
    height: 36px;
    line-height: 36px;
    color: #1AA9FD;
    margin-right: 46px;
    background: none;
  }
  

  /*信息填写不完整提示框*/
  .msg-without-complete .modal-dialog{
      width: 100%;
    height: 100%;
  }
  .msg-without-complete .modal-content{
    width: 50%;
    text-align: center;
    font-size: 16px;
    color: #37B06C;
    line-height: 100px;
    margin: 0 auto;
    top: 50%;
    -left: 50%;
    margin-top: -50px;
  }

  /*删除提示*/
  #delCoverTips .modal-dialog .modal-content{
    width: 90%;
    margin: 0 auto;
  }
  .del-tips{
    height: 40px;
    line-height: 40px;
    text-align: center;
    font-size: 20px;
  }
  .del-tips span{
    color: #f00;
    padding: 0 3px;
  }
  .modal-footer{
    text-align: center;
    padding: 0;
  }
  .modal-footer .form-group.clear-margin-bot{
    margin-bottom: 0;
  }
  .modal-footer .btn{
    outline: none;
  }
  .modal-footer .btn.btn-primary{
    background-color: #00C782;
  }
  .modal-footer .btn-opera .form-group{
    text-align: center;
  }

  /*编辑服务项目*/
  .form-group{
    display: block;
    margin-bottom: 18px;
  }
  .form-group label{
    text-align: right;
  }
  .exp-mark{
    color: red;
    height: 100%;
    line-height: 100%;
    font-size: 14px;
    margin-right: 5px;
    display: inline-block;
  }
  .form-group button{
    width: 136px;
    height: 36px;
    color: #FFF;
  }
  
  span.error{
    color: #f00;
  }
  /*查看机构*/
  .check-org .check-detail .form-group{
    display: block;
    margin-bottom: 18px;
  }
  .check-org .check-detail .form-group label{
    width: 154px;
    font-size: 12px;
    color: #6A6966;
    margin-right: 13px;
  }
  .check-org .check-detail .form-group input{
    width: 478px;
    height: 30px;
    line-height: 30px;
  }
  .check-org .check-detail .form-group textarea{
    width: 478px;
    padding: 10px;
    height: 122px;
    overflow: auto;
    resize: none;
  }
  .check-org .check-detail .form-group select{
    width: 478px;
    appearance:none;
    -moz-appearance:none;/*?Firefox?*/
    -webkit-appearance:none;/*?Safari?和?Chrome?*/
    background: url(../../assets/img/select_bg.png) no-repeat 95% center;
    background-size: 11px 6px;
  }
  .upload-img{
    width: 80px;
    height: 80px;
    border: 0;
    display: inline-block;
  }
  
  /*上传图像按钮*/
  .file-continer{
    display: inline-block;
    border: 0;
    width: 45%;
    height: 50px;
    padding: 0;
    position: relative;
    text-align: left;
    margin-left: 30px;
    /* background: url(../../assets/img/upload_img.png) no-repeat left center;
    background-size: 80px; */
  }
  .reupload-img-btn{
    width: 100px;
    height: 30px;
    line-height: 30px;
    position: relative;
    left: 100px;
    top: 50%;
    margin-top: -15px;
    cursor: pointer;
  }
  .reupload-img-btn span,.reupload-img-btn input{
    width: 100px;
    height: 30px;
    float: left;
    position: absolute;
    top: 0;
    left: 0;
    cursor: pointer;
  }
  .reupload-img-btn span{
    background: #00C484;
    font-size: 16px;
    line-height: 30px;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    text-align: center;
  }
  .reupload-img-btn input{
    opacity: 0;
    filter: alpha(opacity=0);
    z-index: 100;
  }

  /*信息填写不完整提示框*/
  .msg-without-complete{
    -z-index: 10200;
  }
  .msg-without-complete .modal-content{
    width: 50%;
    text-align: center;
    font-size: 16px;
    color: orangered;
    line-height: 100px;
    margin: 0 auto;
    top: 50%;
    -left: 50%;
    margin-top: -50px;
  }

  /*所在地区*/
  #area-provice,#area-city{
    width: 22%;
  }
  .area-lists{
    position: relative;
  }
  .area-lists .area-load{
    position: absolute;
      top: 30px;
      left: 30%;
      width: 45%;
      height: 300px;
      background: pink;
      overflow: auto;
      z-index: 100;
      border-radius: 10px;
  }
  .area-lists .area-load ul li{
    width: 100%;
    height: 30px;
    line-height: 30px;
    font-size: 16px;
    text-align: center;
  }
  .area-lists .area-load ul li a span{
    font-size: 16px;
  }
  #tree_3{
    width: 45%;
    left: 30%;
    height: 211px;
      overflow: auto;
  }
  .j-close-tree{
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 16px;
    display: inline-block;
    line-height: 30px;
    cursor: pointer;
    font-size: 20px;
  }

  /*area-provice-city*/
  .areas-box{
    width: 50%;
    display: inline-block;
    margin-left: 30px;
  }
  .belong-area-title{
    vertical-align: top;
  }

  /*模态提示*/
  #delCoverTips .modal-dialog{
    width: 48%;
    margin: 0 auto;
  }
  /*删除服务提示*/
  .del-tips{
    height: 40px;
    line-height: 40px;
    text-align: center;
    font-size: 20px;
  }
  .del-tips span{
    color: #f00;
    padding: 0 3px;
  }
  .start {
    font-size: 14px;
    color: red
  }
  .imgmodal{
    padding-left: 50%;
    margin-left: -200px;
    height: 250px;
    overflow: hidden;
  }
  .img-tips{
    position: absolute;
    right: 0;
    top: 30%;
    font-size: 14px;
  }
  .del-cover{
    padding: 15px 0;
  }
  .text-right{
    text-align: right;
  }

  /*账户信息*/
  .modal-body .account-content h2.account-title{
    font-size: 22px;
    background: #EEE;
    padding: 5px 5%;
  }
  .modal-body .account-content .form-group label{
    float: left;
  }
  .modal-body .account-content .form-group input{
    margin-left: 10px;
    display: inline-block;
    width: 30%;
  }
  /*二维码*/
  #ewmimg .modal-dialog{
    width: 60%;
  }
  .imgmodal img{
    width: 250px;
    height: 250px;
    position: absolute;
    top: 50%;
    margin-top: -125px;
    left: 50%;
    margin-left: -125px;
  }

  #allmap {
    /*width: 900px;*/
    height: 400px;
    overflow: hidden;
  }
</style>

<template>
    <div class="index clearafter">
        <!-- 头部组件 -->
        <header-component></header-component>
        <div class="content cbafter">
        <!-- 侧部导航组件 -->
        <div class="w220 fl">
            <aside-component></aside-component>
        </div>
        <!-- 右部内容区 -->
        <div class="w980 fr">
          <!-- 路径导航 -->
            <nav class="nav-path">
                <ol class="breadcrumb">
                  <li>系统配置</li>
                  <li class="li-last">租户维护</li>
                  <a href="#" class="return-prev" onclick="javascript:history.back(-1);">返回上一级</a>
                </ol>
            </nav>
            <div class="list-tips breadcrumb">
              <span>租户列表</span>
              <button class="fr default ok add-hsp-btn" @click="addHospitalOrgEvent"> + 添加机构</button>
            </div>
            <!-- 查询相关操作 -->
            <!-- <div class="list-opera">
              <form class="form-inline">
                <div class="form-group">
                  <label for="searchOrgByName">医院名称</label>
                  <input type="text" class="form-control" id="searchOrgByName" placeholder="输入搜索的医院名称" value="{{param.title}}" v-model="param.title" />
                </div>
                <div class="clear-research form-group">
                  <button class="btn btn-default clear-btn" @click.stop.prevent="clearEvent">清  除</button>
                  <button type="submit" class="ok default" @click.stop.prevent="researchEvent">搜 索</button>
                </div>
              </form>
            </div> -->
            <!-- 服务列表内容 -->
            <div class="list-content">
              <table class="table table-striped">
                <table class="table table-hover">
                      <thead>
                          <tr>
                              <th class="col-md-1">序号</th>
                              <th class="col-md-2">租户标识</th>
                              <th class="col-md-2">类型</th>
                              <th class="col-md-2">名称</th>
                              <th class="col-md-5">操作</th>
                          </tr>
                      </thead>
                      <tbody>
                          <tr v-for="($index,lists) in serverData">
                              <td>{{$index+1}}</td>
                              <td>{{lists.tenantId}}</td>
                              <td>{{lists.tenantType | convertTenatType}}</td>
                              <td>{{lists.tenantName}}</td>
                              <td>
                                <a class="glyphicon" @click="watchAndEditEvent(lists)">查看</a>
                                <a class="glyphicon" @click="hspNagationEvent(lists)">机构列表</a>
                                <a class="glyphicon" @click="accountMsgEvent(lists)">产品列表</a>
                                <a class="glyphicon" @click="hspReportEvent(lists)">服务列表</a>
                                <a class="glyphicon" @click="deleteTenatEvent(lists)">删除</a>
                              </td>
                          </tr>
                          <tr class="no-data" v-if="isData">
                            <td colspan="5">暂无查询记录</td>
                          </tr>
                      </tbody>
                  </table>
              </table>   
            </div>
            <!-- 分页 -->
            <bootpage-component v-ref:page :async="true" :lens="lenArr" :page-len="pageLen" :param="param" :headersparam="headersparam"></bootpage-component>
          </div>

          <!--2-添加机构 -->
          <div class="check-org">
            <div id="add-org-cover" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel">
              <div class="modal-dialog" role="document">
                <div class="modal-content">
                  <div class="modal-header">
                    <div class="list-tips breadcrumb">
                        <span class="default-span">{{operaTiele}}</span>
                        <button type="button" class="close" @click.stop.prevent="cancelAddHspEvent">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                  </div>
                  <div class="modal-body cbafter">
                    <!-- 添加-查看-机构表单内容 -->
                    <div class="base-content" v-show="baseMsg">
                        <form action="#" class="form-inline" id="add-hsp-org-form" action="#" enctype="multipart/form-data">
                            <input type="hidden" name="orgId" value="{{addOrgMsg.orgId}}" />
                            <!-- <input type="hidden" name="area" value="{{addOrgMsg.area}}" id="area"/> -->
                          <div class="form-group">
                            <label for="exampleInputName2"><span class="start">*</span>机构全称:</label>
                            <input name="orgFullName" type="text" class="form-control" id="fullName" placeholder="请输入机构全称" value="{{addOrgMsg.orgFullName}}" v-model="addOrgMsg.orgFullName" :disabled="disabledIsShow" />
                          </div>
                          <div class="form-group">
                            <label for="exampleInputName2">机构简称:</label>
                            <input name="orgShortName" type="text" class="form-control" id="shortName" placeholder="请输入机构简称" value="{{addOrgMsg.orgShortName}}" v-model="addOrgMsg.orgShortName" :disabled="disabledIsShow" />
                          </div>
                          <div class="form-group">
                            <label for="exampleInputName2">机构医保局ID:</label>
                            <input name="medicalOrgId" type="text" class="form-control" id="medicalOrgId" placeholder="如：ZS278-282" value="{{addOrgMsg.medicalOrgId}}" v-model="addOrgMsg.medicalOrgId" :disabled="disabledIsShow" />
                          </div>
                           <div class="form-group">
                            <label for="exampleInputName2">机构本地代码:</label>
                            <input name="localOrgId" type="text" class="form-control" id="localOrgId" placeholder="如：ZS278-282" value="{{addOrgMsg.localOrgId}}" v-model="addOrgMsg.localOrgId" :disabled="disabledIsShow" />
                          </div>
                           <div class="form-group">
                            <label for="exampleInputName2" class="list-top-title">上传图片:</label>
                            <div class="file-continer form-control"> 
                              <!-- <img class="imgpres upload-img" :src="defaultUploadImg" alt="" />
                              <div class="reupload-img-btn">
                                <input type="file" id="file" name="avatarField" class="form-control my-files" @change="imgSayPrevious($event)" :disabled="disabledIsShow" />
                                <span>重新上传</span>
                              </div> -->
                              <imgid-btn></imgid-btn>
                              <span class="img-tips">建议图片尺寸750×250(px)</span>
                            </div> 
                          </div>
                          <div class="form-group">
                               <label for="exampleInputName2">医院分类:</label>
                               <select name="orgClassify" id="hospital-sort" class="form-control roles-type" :disabled="disabledIsShow" v-model="sortoption">
                                  <option value="01">医院</option>
                                  <option value="02">社区(中心)</option>
                                  <option value="11">服务站</option>
                                  <option value="03">药店</option>
                                  <option value="04">健康小屋</option>
                                  <option value="05">陪诊机构</option>
                                  <option value="06">养老机构</option>
                                  <option value="07">第三方体检机构</option>
                                  <option value="08">第三方检验机构</option>
                                  <option value="09">商业保险机构</option>
                                  <option value="10">医保机构</option>
                               </select>
                           </div>
                           <div class="form-group">
                               <label for="exampleInputName2">医院性质:</label>
                               <select name="orgNature" id="hospital-nature" class="form-control roles-type" :disabled="disabledIsShow" v-model="natureoption">
                                    <option selected value="01">综合医院</option>
                                    <option value="02">体检中心</option>
                                    <option value="03">妇幼保健院</option>
                                    <option value="04">妇产(科)医院</option>
                                    <option value="05">儿童医院</option>
                                    <option value="06">肿瘤医院</option>
                                    <option value="07">心血管病医院</option>
                                    <option value="08">胸科医院</option>
                                    <option value="09">口腔医院</option>
                                    <option value="10">眼科医院</option>
                                    <option value="11">耳鼻喉科医院</option>
                                    <option value="12">血液病医院</option>
                                    <option value="13">精神病医院</option>
                                    <option value="14">传染病医院</option>
                                    <option value="15">皮肤病医院</option>
                                    <option value="16">结核病医院</option>
                                    <option value="17">麻风病医院</option>
                                    <option value="18">职业病医院</option>
                                    <option value="19">骨科医院</option>
                                    <option value="20">康复医院</option>
                                    <option value="21">整形美容</option>
                               </select>
                           </div>
                           <div class="form-group">
                               <label for="exampleInputName2">医院等级:</label>
                               <select name="orgLevel" id="hospital-rank" class="form-control roles-type" :disabled="disabledIsShow" v-model="rankoption">
                                  <option selected value="10">一级</option>
                                      <option value="11">一级甲等</option>
                                      <option value="12">一级乙等</option>
                                      <option value="13">一级丙等</option>
                                      <option value="20">二级</option>
                                      <option value="21">二级甲等</option>
                                      <option value="22">二级乙等</option>
                                      <option value="23">二级丙等</option>
                                      <option value="30">三级</option>
                                      <option value="31">三级特等</option>
                                      <option value="32">三级甲等</option>
                                      <option value="33">三级乙等</option>
                                      <option value="34">三级丙等</option>
                               </select>
                           </div>
                           <div class="form-group area-lists" v-show="showarea">
                            <label class="belong-area-title" for="exampleInputName2"><span class="start">*</span>所属地区:</label>
                            <div class="areas-box">
                                <area-component></area-component>
                            </div>
                            <!-- <select name="province" id="area-provice" class="form-control roles-type" :disabled="disabledIsShow" v-model="addOrgMsg.province">
                               <option selected value="10">浙江省</option>
                               <option value="11">江苏省</option>
                            </select>
                             <select name="city" id="area-city" class="form-control roles-type" :disabled="disabledIsShow" v-model="addOrgMsg.city">
                               <option selected value="10">杭州市</option>
                               <option value="11">宁波市</option>
                            </select> -->
                          </div>
                          <div class="form-group">
                            <label for="exampleInputName2"><span class="start">*</span>机构地址:</label>
                            <input name="orgAddress" type="text" class="form-control" id="address" placeholder="请输入机构具体地址" value="{{addOrgMsg.orgAddress}}" v-model="addOrgMsg.orgAddress" :disabled="disabledIsShow" />
                          </div>
                          <div class="form-group">
                            <label for="exampleInputName2" class="list-top-title">机构介绍:</label>
                            <textarea name="description" value="{{addOrgMsg.description}}" v-model="addOrgMsg.description" class="form-control sim-explain-textarea" placeholder="请输入机构的相关介绍等" :disabled="disabledIsShow">{{addOrgMsg.description}}</textarea>
                          </div>
                          <div class="form-group" id="map-container1">
                            <label for="exampleInputName2" class="list-top-title">医院地图:</label>
                            <div class="hospital-map">
                                <div id="allmap"></div>
                            </div>
                          </div>
                          <div class="form-group">
                            <label for="exampleInputName2"><span class="start">*</span>经度:</label>
                            <input name="longitude" type="text" class="form-control" id="longitude" placeholder="如：30.0212" value="{{addOrgMsg.longitude}}" v-model="addOrgMsg.longitude" :disabled="disabledIsShow" @blur="baiduMap(addOrgMsg.longitude,addOrgMsg.latitude)" />
                          </div>
                          <div class="form-group">
                            <label for="exampleInputName2"><span class="start">*</span>纬度:</label>
                            <input name="latitude" type="text" class="form-control" id="latitude" placeholder="如：119.221" value="{{addOrgMsg.latitude}}" v-model="addOrgMsg.latitude" :disabled="disabledIsShow" @blur="baiduMap(addOrgMsg.longitude,addOrgMsg.latitude)" />
                          </div>
                          <div class="form-group">
                            <label for="exampleInputName2">咨询电话:</label>
                            <input name="consultNo" type="text" class="form-control" id="exampleInputName2" placeholder="请输入咨询电话" value="{{addOrgMsg.consultNo}}" v-model="addOrgMsg.consultNo" :disabled="disabledIsShow"/>
                          </div>
                          <div class="form-group">
                            <label for="exampleInputName2">紧急电话:</label>
                            <input name="emergencyNo" type="text" class="form-control" id="exampleInputName2" placeholder="请输入急诊科电话" value="{{addOrgMsg.emergencyNo}}" v-model="addOrgMsg.emergencyNo" :disabled="disabledIsShow" />
                          </div>
                          <div class="form-group">
                            <label for="exampleInputName2">联系电话:</label>
                            <input name="contactNo" type="text" class="form-control" id="exampleInputName2" placeholder="请输入联系电话" value="{{addOrgMsg.contactNo}}" v-model="addOrgMsg.contactNo" :disabled="disabledIsShow" />
                          </div>
                          <div class="form-group">
                            <label for="exampleInputName2">医院网址:</label>
                            <input name="homepage" type="text" class="form-control" id="exampleInputName2" placeholder="如：http://www.zsph.com" value="{{addOrgMsg.homepage}}" v-model="addOrgMsg.homepage" :disabled="disabledIsShow" />
                          </div>
                           <div class="form-group">
                            <label for="exampleInputName2" class="list-top-title"><span class="start">*</span>交通说明:</label>
                            <textarea name="trafficDesc" value="{{addOrgMsg.trafficDesc}}" v-model="addOrgMsg.trafficDesc" class="form-control sim-explain-textarea" placeholder="说明交通信息" :disabled="disabledIsShow" id="trafficExplain">{{addOrgMsg.trafficDesc}}</textarea>
                          </div>
                          <div class="form-group">
                            <label for="exampleInputName2">邮编:</label>
                            <input name="postcode" type="text" class="form-control" id="exampleInputName2" placeholder="请输入邮编" value="{{addOrgMsg.postcode}}" v-model="addOrgMsg.postcode"  :disabled="disabledIsShow" />
                          </div>
                          <div class="form-group">
                            <label for="exampleInputName2">传真:</label>
                            <input name="fax" type="text" class="form-control" id="exampleInputName2" placeholder="请输入传真号码" value="{{addOrgMsg.fax}}" v-model="addOrgMsg.fax"  :disabled="disabledIsShow" />
                          </div>
                        
                          <div class="modal-footer">
                            <div class="btn-opera">
                                <div class="form-group form-group-foot" v-show="addOperaEvent">
                                  <button type="submit" class="btn btn-default save-btn" @click.stop.prevent="confirmAddHspEvent">保 存</button>
                                  <button class="btn btn-default cancel-btn" @click.stop.prevent="cancelAddHspEvent">取 消</button>
                                </div>
                                <div class="form-group form-group-foot" v-show="watchEditOpera">
                                  <button type="button" class="btn btn-default save-btn" v-if="nowEditShow" @click.stop.prevent="editHspMsgEvent">编 辑</button>
                                  <button type="button" class="btn btn-default save-btn" v-if="nowSaveShow" @click.stop.prevent="confirmSaveHspMsgEvent">保 存</button>
                                  <button class="btn btn-default cancel-btn" @click.stop.prevent="cancelEditHspEvent">取 消</button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--账户信息-->
                    <div class="account-content" v-show="accountMsg">
                        <div class="form-group clear-margin-bot del-cover text-right">
                            <button type="button" class="save-btn" @click.stop.prevent="saveAccountMsgEvent">保存</button>
                            <button type="button" class="cancel-btn" data-dismiss="modal">取消</button>
                        </div>
                        <form action="#" class="form-inline" id="account-message" enctype="multipart/form-data">

                            <!-- 支付宝账户 -->
                            <h2 class="account-title">支付宝</h2>
                            <div class="form-group">
                                <label for="exampleInputName2">支付宝账号:</label>
                                <input name="account" type="text" class="form-control" placeholder="支付宝账号" value="{{AliPay.account}}" v-model="AliPay.account" />
                            </div>
                            <div class="form-group">
                                <label for="exampleInputName2">合作者身份(PID):</label>
                                <input name="partnerId" type="text" class="form-control" placeholder="合作者身份(PID)" value="{{AliPay.partnerId}}" v-model="AliPay.partnerId" />
                            </div>
                            <div class="form-group">
                                <label for="exampleInputName2">商户私钥(privetaKey):</label>
                                <input name="privateKey" type="text" class="form-control" placeholder="商户私钥(privetaKey)" value="{{AliPay.privateKey}}" v-model="AliPay.privateKey" />
                            </div>
                            <div class="form-group">
                                <label for="exampleInputName2">Appid:</label>
                                <input name="appId" type="text" class="form-control" placeholder="Appid" value="{{AliPay.appId}}" v-model="AliPay.appId" />
                            </div>
                            <div class="form-group">
                                <label for="exampleInputName2">AliPublicKey:</label>
                                <input name="aliPublicKey" type="text" class="form-control" placeholder="AliPublicKey" value="{{AliPay.aliPublicKey}}" v-model="AliPay.aliPublicKey" />
                                <span class="explains">开放平台秘钥管理，查看支付宝公钥</span>
                            </div>

                            <!-- 微信账户 -->
                            <h2 class="account-title">微信</h2>
                            <div class="form-group">
                                <label for="exampleInputName2">微信账号:</label>
                                <input name="account" type="text" class="form-control" placeholder="微信账号" value="{{wechatPay.account}}" v-model="wechatPay.account" />
                            </div>
                            <div class="form-group">
                                <label for="exampleInputName2">合作商户ID(partnerId):</label>
                                <input name="partnerId" type="text" class="form-control" placeholder="合作商户ID(partnerId)" value="{{wechatPay.partnerId}}" v-model="wechatPay.partnerId" />
                            </div>
                            <div class="form-group">
                                <label for="exampleInputName2">商户私钥(privetaKey):</label>
                                <input name="privateKey" type="text" class="form-control" placeholder="商户私钥(privetaKey)" value="{{wechatPay.privateKey}}" v-model="wechatPay.privateKey" />
                            </div>
                            <div class="form-group">
                                <label for="exampleInputName2">Appid:</label>
                                <input name="appId" type="text" class="form-control" placeholder="Appid" value="{{wechatPay.appId}}" v-model="wechatPay.appId" />
                            </div>

                            <!-- 银联账户 -->
                            <h2 class="account-title">银联</h2>
                            <div class="form-group">
                                <label for="exampleInputName2">银行卡号:</label>
                                <input name="account" type="text" class="form-control" placeholder="银行卡号" value="{{bankPay.account}}" v-model="bankPay.account" />
                            </div>
                            <div class="form-group">
                                <label for="exampleInputName2">商户ID:</label>
                                <input name="partnerId" type="text" class="form-control" placeholder="商户ID" value="{{bankPay.partnerId}}" v-model="bankPay.partnerId" />
                            </div>
                            <div class="form-group">
                                <label for="exampleInputName2">商户私钥(privetaKey):</label>
                                <input name="privateKey" type="file" class="form-control" id="file" placeholder="+ 选择文件" />
                            </div>
                            <div class="form-group">
                                <label for="exampleInputName2">私钥密码:</label>
                                <input name="bankPay.privateKey" type="text" class="form-control" placeholder="私钥密码" value="{{bankPay.privateKey}}"  v-model="bankPay.privateKey" />
                            </div>

                            <!--中福-->
                            <h2 class="account-title">中福统一支付平台账号配置</h2>
                            <div class="form-group">
                                <label for="exampleInputName2">收款商户名:</label>
                                <input name="orgFullName" type="text" class="form-control" placeholder="收款商户名" v-model="ZhongFu.account" />
                                <span class="explains">收款商户名、商户号由中福支付统一提供</span>
                            </div>
                            <div class="form-group">
                                <label for="exampleInputName2">收款商户号:</label>
                                <input name="orgFullName" type="text" class="form-control" placeholder="收款商户号" v-model="ZhongFu.partnerId" />
                            </div>
                        </form>
                    </div>
                </form>
                  </div>
                </div><!-- /.modal-content -->
              </div><!-- /.modal-dialog -->
            </div><!-- /.modal -->
          </div>

          <!--二维码-->
          <div id="ewmimg" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <div class="list-tips breadcrumb">
                  <span class="default-span">医院二维码</span>
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span></button>
                </div>
              </div>
              <div class="modal-body cbafter">
                   <div class="imgmodal">
                       <img src="" alt="后台暂无数据返回………………" id="ewm"/>
                   </div>
              </div>
                <div class="modal-footer">
                </div>
            </div>
          </div>
          </div>

          <!-- 信息填写不完整 -->
          <div class="modal fade msg-without-complete" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
              <div class="modal-dialog modal-sm" role="document">
              <div class="modal-content">
                  {{subErrorMsg}}
              </div>
              </div>
          </div><!--msg-not-complete-->
          <!-- 删除提示 -->
          <div id="delCoverTips" class="modal fade" tabindex="-1" role="dialog">
            <div class="modal-dialog" role="document">
              <div class="modal-content">
                <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                  <h4 class="modal-title">机构删除</h4>
                </div>
                <div class="modal-body">
                  <p class="del-tips">您确定要删除此"<span v-text="delTenatName"></span>"租户吗？</p>
                </div>
                <div class="modal-footer">
                  <div class="form-group clear-margin-bot del-cover">
                    <button type="button" class="save-btn" @click.stop.prevent="confirmDeleteOrg">确认</button>
                    <button type="button" class="cancel-btn" data-dismiss="modal">取消</button>
                  </div>
                </div>
              </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
          </div><!-- /.modal --> 
        </div><!-- 内容区 -->
        </div>
    </div>
</template>
 
<script>
  import 'assets/reset.css';
  import 'assets/lib/bootstrap-3.3.2/css/bootstrap.min.css';
  import 'assets/lib/bootstrap-3.3.2/js/bootstrap.min.js';

  import Header from 'components/module-head.vue';
  import Asider from 'components/menu-list.vue';
  import footerPage from 'components/BootPage.vue';
  import areaPlugin from 'components/area-comp-org.vue';
  import ImgUploadBtn from 'components/ImgUploadBtn.vue'
  import Public from 'assets/public.js'

  export default {
    data () {
      return {
        headersparam: {
            'X-Service-Id': 'base.sysOrgTenantService',
            'X-Service-Method': 'queryOrgTenant'
        },
        param: {
            pageNo: 1,
            pageSize: 10
        },

        //基本信息--账号信息
        baseMsg: true,
        accountMsg: false,
                
        //获取地区返回的文件树数据
        getAreaTreeData: [],
        //相应操作标题
        operaTiele: '',
        //机构标题
        orgTitle: '',
        //信息填写不完整--删除失败
        subErrorMsg: '',
        //图片地址(上传预览)
        defaultUploadImg: '',
        serverData: {},
        //机构管理
        isOrgManage: true,
        //查看机构--添加机构(导航树)
        isWatchOrg: false,
        isAddOrg: false,
        //查看机构--添加机构(内容列表)
        isCheckOrg: false,
        //添加--机构相关信息(校验)
        addOrgMsg: {  
            orgId:"",//机构Id,新增时候不传
            consultNo: "",//咨询电话
            orgFullName: "",//机构全称
            fax: "",//传真
            orgAddress: "",//机构地址
            orgShortName: "",//简称
            street: "",//街道编码
            emergencyNo: "",//紧急电话
            medicalOrgId: "",//机构医保局id
            postcode: "",//邮政编码
            localOrgId: "",//机构代码
            city: "",//地址（市）
            avatarField: 2,//机构照片地址id
            parentId: 0,//上级机构Id
            orgNature: "",//机构性质
            trafficDesc: "",//交通说明
            province: "",//地址（省）
            orgClassify: "",//机构分类
            longitude: "",//经度
            latitude: "",//维度
            district: "",//地址（区、县）
            orgLevel: "",//机构级别
        },

        //支付宝
        AliPay: {
          aliPublicKey: "",
          orgId: "",
          appId: "",
          privateKey: "",
          partnerId: "",
          accountType: "02",
          account: "",
          recordId: ""//新增时候不传
        },
        //微信
        wechatPay: {
          aliPublicKey: "",
          orgId: "",
          appId: "",
          privateKey: "",
          partnerId: "",
          accountType: "03",
          account: "",
          recordId: ""//新增时候不传
        },
        //银联
        bankPay: {
          aliPublicKey: "",
          orgId: "",
          appId: "",
          privateKey: "",
          partnerId: "",
          accountType: "04",
          account: "",
          recordId: ""//新增时候不传
        },
        //中福
        ZhongFu: {
          orgId: "",
          account: '',
          partnerId: '',
          accountType: '06'
        },

        //提交支付数据
        submitPayType: [],

        //点击'添加'?'查看'
        addOperaEvent: false,
        watchEditOpera: false,
        //编辑？保存
        nowEditShow: true,
        nowSaveShow: false,
        //是否可以编辑
        disabledIsShow: 'disabled',
        //是否显示地区选择
        isSelArea: false,
        //要删除的租户名称-id
        delTenatName: '',
        tenantId: '',

        //是否有记录
        isData: false,
        //焦点
        isfocus:"",
        //是否显示地区
        showarea:true,
        rankoption:'01',
        natureoption:'02',
        sortoption:'02',

        //百度地图检索--关键字
        provinceIndex: '',
        cityIndex: '',
        areaIndex: '',
        streetIndex: '',

        //检索地址
        indexAddress: ''
      }
    },
    events: {
      'data': function(datas){
        this.serverData = datas;
      },
      'areadata': function(areas){
        this.addOrgMsg.province = areas.province;
        this.addOrgMsg.city = areas.city;
        //this.addOrgMsg.area = areas.area;
        this.addOrgMsg.street = areas.street;
      }
    },
    watch: {
      'serverData': 'isWatchServerData'
    },
    filters: {
      //转换租户类型
      'convertTenatType': function(tp){
        switch(tp){
          case '01': 
            return '集团化医院';
          case '02' :
            return '医疗中心';
          case '03' :
            return '城市级医联';
          case '04' :
            return '互联网医联';
          default :
            return '未说明';
        }
      }
    },
    ready () {  
      var that = this;
      this.isData = (this.serverData.length == '' || null || 'undefined') ? true:false;
    },
    components: {
      //头部组件
      'header-component': Header,
      //侧部导航组件
      'aside-component': Asider,
      'bootpage-component': footerPage,
      'area-component': areaPlugin,
      'imgid-btn': ImgUploadBtn
    },
    methods: {
      //监听数据变化显示是否有记录
      isWatchServerData: function(){
        if(this.serverData.length == '' || this.serverData.length == null || this.serverData.length == 'undefined'){
          this.isData = true;
        }else{
          this.isData = false;
        };
      },
      
      //清除
      clearEvent: function(){
        this.param.title = '';
        this.$refs.page.refresh();
      },
      //搜索
      researchEvent: function(){
        this.$refs.page.refresh();
      },

      //清空基本信息
      clearBaseMsgEvent: function(){
          this.addOrgMsg.orgId = '';
          this.addOrgMsg.consultNo = '';
          this.addOrgMsg.orgFullName = '';
          this.addOrgMsg.fax = '';
          this.addOrgMsg.orgAddress = '';
          this.addOrgMsg.orgShortName = '';
          this.addOrgMsg.street = '';
          this.addOrgMsg.emergencyNo = '';
          this.addOrgMsg.medicalOrgId = '';
          this.addOrgMsg.postcode = '';
          this.addOrgMsg.localOrgId = '';
          this.addOrgMsg.city = '';
          this.addOrgMsg.avatarField = 0;
          this.addOrgMsg.parentId = '';
          this.addOrgMsg.orgNature = '';
          this.addOrgMsg.trafficDesc = '';
          this.addOrgMsg.province = '';
          this.addOrgMsg.orgClassify = '';
          this.addOrgMsg.longitude = '';
          this.addOrgMsg.latitude = '';
          this.addOrgMsg.district = '';
          this.addOrgMsg.orgLevel = '';
      },
            
      //添加医院机构
      addHospitalOrgEvent: function(){
        this.operaTiele = '添加机构';
        //机构标题
        this.clearBaseMsgEvent();
        this.defaultUploadImg= '';
        //添加？查看？
        this.addOperaEvent = true;
        this.watchEditOpera = false;
        this.disabledIsShow = false;
        this.showarea=true;
        this.baiduMap(116.331398,39.897445);
        $('#add-org-cover').modal('show');
        //表单切换
        this.baseMsg = true;
        this.accountMsg = false;
      },

      //确认--添加
      confirmAddHspEvent: function(){
        var that = this;
        //校验--数据 
        var flag = this.validationForm();
        //请求--判断
        if(flag == true){
          $.when(Public.commonajax('base.sysOrganizationService','saveOrg','['+JSON.stringify(this.addOrgMsg)+']')).done(function(res){
            if(res.code == 200 || res.code == 1){
               that.subErrorMsg = '保存成功！';
              $('.msg-without-complete').modal('show');
              setTimeout(function(){
                $('.msg-without-complete').modal('hide');
              $('#add-org-cover').modal('hide');
              },1500);
              that.$refs.page.refresh();
            }else{
              that.subErrorMsg = res.msg;
              $('.msg-without-complete').modal('show');
              setTimeout(function(){
                $('.msg-without-complete').modal('hide');
                //$('#add-org-cover').modal('hide');
              },1500);
              return false;
            };
          });
        }else{
          $('.msg-without-complete').modal('show');
          this.disabledIsShow = false;
          this.nowEditShow = false;
          this.nowSaveShow = true;
          setTimeout(function(){
            $('.msg-without-complete').modal('hide');
            $('#add-org-cover').modal('show');
            $('#add-org-cover').css({'overflow-y':'scroll'});
          },1500);
          return false;
        };  
      },
      //取消--添加
      cancelAddHspEvent: function(){
         this.addOrgMsg.orgId = '';
         this.addOrgMsg.qrCode = '';
         this.addOrgMsg.qrAvatarFileId = '';
         this.addOrgMsg.localOrgId = '';
         this.addOrgMsg.fullName = '';
         this.addOrgMsg.shortName = '';
         this.addOrgMsg.classify = '';
         this.addOrgMsg.area = '';
         this.addOrgMsg.nature = '';
         this.addOrgMsg.level = '';
         this.addOrgMsg.mnemonic = '';
         this.addOrgMsg.createDt = '';
         this.addOrgMsg.lastModify = '';
         this.addOrgMsg.source = '';
         this.addOrgMsg.status = '';
        $('#add-org-cover').modal('hide');
      },

      //查看--编辑机构（医院）
      watchAndEditEvent: function(lists){
        this.operaTiele = '查看机构';
        this.baseMsg = true;
        this.accountMsg = false;
        //添加？查看？
        this.showarea=false;
        this.addOperaEvent = false;
        this.watchEditOpera = true;
        this.nowEditShow = true;
        this.nowSaveShow = false;
         this.isSelArea=false;
        this.defaultUploadImg= '';
        $('#add-hsp-org-form')[0].reset();
        $('#add-org-cover').modal('show');
        //根据经纬度来渲染地图定位
        this.baiduMap(lists.longitude,lists.latitude);

        //已有数据展示
        var that=this;
        $.when(Public.commonajax('base.sysOrganizationService',"getDetail",'["'+lists.orgId+'"]')).done(function(res){
            that.addOrgMsg=res.body;
            that.rankoption=res.body.orgLevelText;
            that.natureoption=res.body.orgNatureText;
            that.sortoption=res.body.orgClassify;
            let avat = res.body.avatarField;
            if(avat!=""&&avat!=undefined){
                that.defaultUploadImg= avat;
             }
          });

        this.disabledIsShow = 'disabled';
        $('#add-org-cover').modal('show');
      },
      //查看--编辑机构--编辑(可编辑状态)
      editHspMsgEvent: function(){
        //机构标题
        this.operaTiele = '编辑机构';
        this.disabledIsShow = false;
        this.nowEditShow = false;
        this.nowSaveShow = true;
      },
      //查看--编辑机构--保存
      confirmSaveHspMsgEvent: function(){
        //$('#add-org-cover').modal('show');
        this.disabledIsShow = 'disabled';
        this.nowEditShow = true;
        this.nowSaveShow = false;
        this.confirmAddHspEvent();
      },
      //查看--编辑机构--取消
      cancelEditHspEvent: function(){
        this.disabledIsShow = 'disabled';
        this.nowEditShow = true;
        this.nowSaveShow = false;
        $('#add-org-cover').modal('hide');
      },

      //医院导航
      hspNagationEvent: function(lists){
        location.href = './orgnavigation.html?id='+lists.orgId;
      },

      //账号信息
      accountMsgEvent: function(lists){
        this.operaTiele = '账号信息';
        //表单切换
        this.baseMsg = false;
        this.accountMsg = true;
        $('#add-org-cover').modal('show');
        var that = this;
        $.when(Public.commonajax('base.sysOrganizationService','queryOrgPayInfo','["'+lists.orgId+'"]')).done(function(res){
            $.each(res.body,function(index,ele){
                if(ele.accountType == '02'){
                    that.AliPay = ele;
                    //return false;
                };
                if(ele.accountType == '03'){
                    that.wechatPay = ele;
                    //return false;
                };
                if(ele.accountType == '04'){
                    that.bankPay = ele;
                    //return false;
                };
                if(ele.accountType == '06'){
                    that.ZhongFu = ele;
                    //return false;
                };
            });
        });
        //赋值机构id
        this.AliPay.orgId = lists.orgId;
        this.wechatPay.orgId = lists.orgId;
        this.bankPay.orgId = lists.orgId;
        this.ZhongFu.orgId = lists.orgId;
      },
      //保存账号信息
      saveAccountMsgEvent: function(){
        var that = this;
        var tag = this.accountValidation();
            tag = tag.split(':');
            //console.log(tag)字符型
        if(tag[0] == 'false'){
          this.subErrorMsg = '支付宝账户所有项目为必填！';
          $('.msg-without-complete').modal('show');
          setTimeout(function(){$('.msg-without-complete').modal('hide')},1800);
          return false;
        };
        if(tag[1] == 'false'){
          this.subErrorMsg = '微信账户所有项目为必填！';
          $('.msg-without-complete').modal('show');
          setTimeout(function(){$('.msg-without-complete').modal('hide')},1800);
          return false;
        };
        if(tag[2] == 'false'){
          this.subErrorMsg = '银联账户所有项目为必填！';
          $('.msg-without-complete').modal('show');
          setTimeout(function(){$('.msg-without-complete').modal('hide')},1800);
          return false;
        };
        if(tag[3] == 'false'){
          this.subErrorMsg = '中福账户所有项目为必填！';
          $('.msg-without-complete').modal('show');
          setTimeout(function(){$('.msg-without-complete').modal('hide')},1800);
          return false;
        };
        $.when(Public.commonajax('base.sysOrganizationService','saveOrgPayInfo','['+JSON.stringify(this.submitPayType)+']')).done(function(res){
            if(res.code == 200){
                that.subErrorMsg = '保存成功！';
                $('#add-org-cover').modal('hide');
                $('.msg-without-complete').modal('show');
                setTimeout(function(){
                  $('.msg-without-complete').modal('hide');
                },1500);
            };
        });
      },

      //报告说明
      hspReportEvent: function(lists){
        location.href = './orgReport.html?orgId='+lists.orgId;
      },
      
      //查看二维码
      watchQrCodeEvent: function(qrCode){
        $.when(Public.commonajax('base.sysOrganizationService',"qrAvatarFileId",'["'+qrCode.orgId+'"]')).done(function(res){
                    $("#ewm").attr("src",Public.IMGVIEW_URL()+res.body);
        });
        $("#ewmimg").modal("show");
      },

      //删除机构
      deleteTenatEvent (lists) {
        this.delTenatName = lists.tenantName;
        this.tenantId = lists.tenantId;
        $('#delCoverTips').modal('show');
      },

      //确认--删除机构
      confirmDeleteOrg () {
        var that = this;
        $.when(Public.commonajax('base.sysOgTenantService','deleteOrgcloud','["'+this.tenantId+'"]')).done(function(res){
            if(res.code == 200){
              that.$refs.page.refresh();
              $('#delCoverTips').modal('hide');
            }else{
              that.subErrorMsg = res.msg;
              $('#delCoverTips').modal('show');
            };
        });
        setTimeout(function(){$('#delCoverTips').modal('hide');},1800);
      },

      //图像预览
      imgSayPrevious: function(event){
        var that = this;
        var img = $('.imgpres');
        var ipt = $('.my-files');
        var file  = event.target.files[0];
        var reader = new FileReader();
                  reader.readAsDataURL(file);
                  reader.onload = function (event) {
                      that.defaultUploadImg = event.target.result;
                  };
      },
      //百度地图(经纬度)
      baiduMap:function(longs,latati){
            longs = longs == '' ? 116.404 : longs;
            latati = latati == '' ? 39.915 : latati;
            //console.log(longs+':'+latati);
        var that = this;
        setTimeout(function(){
            // 创建Map实例,设置地图允许的最小/大级别
            var map = new BMap.Map("allmap"); 
                map.centerAndZoom(new BMap.Point(longs,latati),12); 
                map.enableScrollWheelZoom(true); 
                map.addControl(new BMap.MapTypeControl());   //添加地图类型控件  
            let new_point = new BMap.Point(longs,latati);
            let marker = new BMap.Marker(new_point);  // 创建标注
                map.addOverlay(marker);              // 将标注添加到地图中
               // map.panTo(new_point);       
            //单击获取点击的经纬度
            map.addEventListener("click",function(e){
                  that.addOrgMsg.longitude = e.point.lng;
                  that.addOrgMsg.latitude = e.point.lat;
                  map.clearOverlays();
              let new_point = new BMap.Point(e.point.lng,e.point.lat);
              let marker = new BMap.Marker(new_point);  // 创建标注
                  map.addOverlay(marker); 
            });
        },200);
        
      },
      //百度地图检索(关键字)
      baiduMapIndex: function(indexAdd){
        var that = this;
        //检索
        var map = new BMap.Map("allmap");
        map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);
        var local = new BMap.LocalSearch(map, {
          renderOptions:{map: map}
        });
        map.enableScrollWheelZoom(true);
        //获取经纬度
        map.clearOverlays();//清空原来的标注
        local.setSearchCompleteCallback(function (searchResult) {
            var poi = searchResult.getPoi(0);
                that.addOrgMsg.longitude = poi.point.lng;
                that.addOrgMsg.latitude = poi.point.lat;
            map.centerAndZoom(poi.point, 13);
            var marker = new BMap.Marker(new BMap.Point(poi.point.lng, poi.point.lat));  // 创建标注，为要查询的地址对应的经纬度
            map.addOverlay(marker);
            marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
        });
        local.search(indexAdd);
        //map.click
        map.addEventListener("click",function(e){
              that.addOrgMsg.longitude = e.point.lng;
              that.addOrgMsg.latitude = e.point.lat;
              map.clearOverlays();
          let new_point = new BMap.Point(e.point.lng,e.point.lat);
          let marker = new BMap.Marker(new_point);  // 创建标注
              map.addOverlay(marker); 
        });
      },

      showMess:function(){
        $('.msg-without-complete').modal('show');
      },

      //表单验证
      validationForm: function(){
        var fullName=$("#fullName").val();
        var provice=$("#provice").val();
        var city=$("#city").val();
        var address=$("#address").val();
        var longitude=$("#longitude").val();
        var latitude=$("#latitude").val();
        var consultNo=$("#consultNo").val();
        var emergencyNo=$("#emergencyNo").val();
        var contactNo=$("#contactNo").val();
        var trafficExplain=$("#trafficExplain").val();
                var postcode=$("#postcode").val();
                var homepage=$("#homepage").val();
                var localOrgId=$("#localOrgId").val();
                var fax=$("#fax").val();
          if(fullName == ''||fullName==undefined){
                      this.subErrorMsg = '机构全称不能为空！';
                      return false;
          }
          if(provice == ''|| city == ''){
                      this.subErrorMsg = '所在地区不能为空！';
                      return false;
          }
          if(address == ''||address==undefined){
             this.subErrorMsg = '机构地址不能为空！';
             return false;
          }
          if(trafficExplain == ''||trafficExplain==undefined){
             this.subErrorMsg = '交通说明不能为空！';
             return false;
          }
          var expReg =/^0\d{2,3}-?\d{7,8}$/;
          var expRegUrl = new RegExp('^(((ht|f)tp(s?))\://)?(www.|[a-zA-Z].)[a-zA-Z0-9\-\.]+\.(com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk)(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\;\?\'\\\+&amp;%\$#\=~_\-]+))*$');
          var longitudeExp = /^[-]?(\d|([1-9]\d)|(1[0-7]\d)|(180))(\.\d*)?$/g;
          var latitudeExp = /^[-]?(\d|([1-8]\d)|(90))(\.\d*)?$/g;
          if(expReg.test(consultNo) == false&&consultNo!=undefined){
            this.subErrorMsg = '咨询电话填写格式有误！';
            $('.msg-without-complete').modal('show');
            return false;
          }if(expReg.test(emergencyNo) == false&&emergencyNo!=undefined){
            this.subErrorMsg = '急诊科电话格式填写有误！';
            $('.msg-without-complete').modal('show');
            return false;
          }if(expReg.test(contactNo) == false&&contactNo!=undefined){
            this.subErrorMsg = '联系电话填格式写有误！';
            $('.msg-without-complete').modal('show');
            return false;
          }if(expRegUrl.test(homepage) == false&&homepage!=undefined){
            this.subErrorMsg = '网址格式填写有误！';
            $('.msg-without-complete').modal('show');
            return false;
          }if(/^[0-9]{6}$/.test(postcode) == false&&postcode!=undefined){
            this.subErrorMsg = '邮编格式填写有误！';
            $('.msg-without-complete').modal('show');
            return false;
          }if(/^(\d{3,4}-)?\d{7,8}$/.test(fax) == false&&fax!=undefined){
            this.subErrorMsg = '传真格式填写有误！';
            $('.msg-without-complete').modal('show');
            return false;
          }if(longitudeExp.test(longitude) == false || longitude == ''){
             this.subErrorMsg = '经度坐标范围为 -180 ~ 180';
            $('.msg-without-complete').modal('show');
            return false;
          }if(latitudeExp.test(latitude) == false || latitude == ''){
             this.subErrorMsg = '纬度坐标范围为 -90 ~ 90 ';
            $('.msg-without-complete').modal('show');
            return false;
          }
          
            $('.msg-without-complete').modal('hide');
            return true;  
      },

      //账号信息验证
      accountValidation: function(){
        var that = this;
        var saveMsgArray = [];
        //支付宝
        var flag_Ali = (this.AliPay.account != '') || (this.AliPay.partnerId != '') || (this.AliPay.privateKey != '') || (this.AliPay.appId != '') || (this.AliPay.aliPublicKey != '');
        if(flag_Ali == true){
          var flag_AliPay = (this.AliPay.account != '')&&(this.AliPay.partnerId != '')&&(this.AliPay.privateKey != '')&&(this.AliPay.appId != '')&&(this.AliPay.aliPublicKey != '');
          if(flag_AliPay == false){flag_Ali = false}else{
            saveMsgArray.push(this.AliPay);
          };
        }else{
          flag_Ali = true;
        };

        //微信
        var flag_Wei = (this.wechatPay.account != '') || (this.wechatPay.partnerId != '') || (this.wechatPay.privateKey != '') || (this.wechatPay.appId != '');
        if(flag_Wei == true){
          var flag_WeiPay = (this.wechatPay.account != '')&&(this.wechatPay.partnerId != '')&&(this.wechatPay.privateKey != '')&&(this.wechatPay.appId != '');
          if(flag_WeiPay == false){flag_Wei = false}else{
            saveMsgArray.push(this.wechatPay);
          };
        }else{
          flag_Wei = true;
        };

        //银联
        var flag_Bank = (this.bankPay.account != '') || (this.bankPay.partnerId != '') || (this.bankPay.privateKey != '');
        if(flag_Bank == true){
          var flag_BankPay = (this.bankPay.account != '')&&(this.bankPay.partnerId != '')&&(this.bankPay.privateKey != '');
          if(flag_BankPay == false){flag_Bank = false}else{
            saveMsgArray.push(this.bankPay);
          };
        }else{
          flag_Bank = true;
        };

        //中福
        var flag_ZhongFu = (this.ZhongFu.account != '') || (this.ZhongFu.partnerId != '');
        if(flag_ZhongFu == true){
          var flag_ZFPay = (this.ZhongFu.account != '')&&(this.ZhongFu.partnerId != '');
          if(flag_ZFPay == false){flag_ZhongFu = false}else{
            saveMsgArray.push(this.ZhongFu);
          };
        }else{
          flag_ZhongFu = true;
        };
        let boolenVal = flag_Ali+':'+flag_Wei+':'+flag_Bank+':'+flag_ZhongFu;
            this.submitPayType = saveMsgArray;
        return boolenVal;
      }
    }//methods
  }



</script>
